﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace weighing
{
    /// <summary>
    /// 高级权限
    /// </summary>
    public class HightPermissionVisbilityConveter : System.Windows.Data.IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (App.CurrentUser == null || parameter == null) return Visibility.Collapsed;

            UserRoleType type = (UserRoleType)parameter;

            if (App.CurrentUser.roleType == null ||(int)App.CurrentUser.roleType >= (int)type)
            {
                return Visibility.Visible;
            }
            else
            {
                return Visibility.Collapsed;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
